<template>
  <div>
    <footer class="footer">
      <span class="todo-count"
        ><strong>{{ sum }}</strong
        >剩余</span
      >
      <ul class="filters">
        <li>
          <a :class="{ selected: type === 'all' }" @click="changeType('all')" href="#/">全部</a>
        </li>
        <li>
          <a :class="{ selected: type === 'active' }" @click="changeType('active')" href="#/active">进行中</a>
        </li>
        <li>
          <a :class="{ selected: type === 'completed' }" @click="changeType('completed')" href="#/completed">已完成</a>
        </li>
      </ul>
      <button class="clear-completed" v-show="showClearAll" @click="delAll">清除已完成</button>
    </footer>
  </div>
</template>

<script>
export default {
  name: 'FooterTodo',
  components: {},
  props: {
    sum: {
      type: Number,
      require: true
    },
    showClearAll: {
      type: Boolean,
      require: true
    },
    type: {
      type: String,
      require: true
    }
  },
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    // 清除所有已选中
    delAll() {
      this.$emit('delAll')
    },

    // 切换type内容
    changeType(type) {
      this.$emit('changeType', type)
    }
  }
}
</script>

<style scoped></style>
